package com.mixsmart.commonweb.bean.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.DynamicUpdate;

import com.mixsmart.commonweb.bean.ICreateTime;
import com.mixsmart.commonweb.bean.IPKStringBean;
import com.mixsmart.commonweb.enums.UrlResourceType;
import com.mixsmart.enums.YesNoType;

/**
 * URL资源--实体对象
 * @author lmq
 * @version 1.0
 * @since JDK版本大于等于1.6
 * 2016年1月26日
 */
@Entity
@Table(name="t_c_url_resource")
@DynamicUpdate(true)
public class TCUrlResource implements IPKStringBean, ICreateTime {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1331295303162193589L;

	private String id;
	
	private String name;
	
	private String url;
	
	/**
	 * 资源类型
	 */
	private String urlResType = UrlResourceType.MENU_URL_RESOURCE.getValue();
	
	private Integer state = YesNoType.YES.getIndex();
	
	private Date createTime;
	
	private List<TCUrlResOpFlag> resOpFlags;

	public TCUrlResource() {
	}

	public TCUrlResource(String name, String url, Integer state) {
		this.name = name;
		this.url = url;
		this.state = state;
	}
	
	public TCUrlResource(String name, String url, Integer state, String resType) {
		this.name = name;
		this.url = url;
		this.state = state;
		this.urlResType = resType;
	}

	///////getter and setter/////
	
	@Id
	@Column(name="id", length=50, nullable=false)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name="name", length=255, nullable=false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name="url", length=255, nullable=false)
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Column(name="state")
	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="create_time",updatable=false)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name="url_res_type",length=127)
	public String getUrlResType() {
		return urlResType;
	}

	public void setUrlResType(String urlResType) {
		this.urlResType = urlResType;
	}

	@Transient
	public List<TCUrlResOpFlag> getResOpFlags() {
		return resOpFlags;
	}

	public void setResOpFlags(List<TCUrlResOpFlag> resOpFlags) {
		this.resOpFlags = resOpFlags;
	}
	
}
